{include file="public/top" /}

<body>
<div class="x-body">
    <form class="layui-form">
        <div class="layui-form-item">
            <input type="hidden" value="{$data.id}" name="id">
            <label for="username" class="layui-form-label">
                <span class="x-red">*</span>分类名称
            </label>
            <div class="layui-input-inline">
                <input type="text" id="username" value="{$data.name}" name="name" required="" lay-verify="required"
                       autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red">*</span>请写入分类名称
            </div>
            <br><br><br>
            <div class="layui-form-item">
                <label  class="layui-form-label">
                    <span class="x-red">*</span>标题(SEO)
                </label>
                <div class="layui-input-block">
                    <input type="text" id="title" name="title" value="{$data.title}" required="" lay-verify="required"
                           autocomplete="off" class="layui-input">
                </div>

            </div>
            <div class="layui-form-item">
                <label  class="layui-form-label">
                    <span class="x-red">*</span>关键词(SEO)
                </label>
                <div class="layui-input-block">
                    <input type="text" id="keyword" name="keyword" value="{$data.keyword}" required="" lay-verify="required"
                           autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label  class="layui-form-label">
                    <span class="x-red">*</span>描述(SEO)
                </label>
                <div class="layui-input-block">
                    <textarea style="width: 800px;height: 100px" name="description">{$data.description}</textarea>
                </div>
            </div>

        </div>
        <div>
            <span class="x-red">*</span>分类介绍
            <script type="text/plain" id="editor" class="ueueueue">{$data.content}</script>
            <div class="con-split" style="height: 100px;"></div>
        </div>
        <br>
        <div class="layui-form-item">
            <button type="button"  class="layui-btn layui-btn-normal" lay-filter="up" lay-submit="">提交</button>
        </div>
    </form>
</div>
<script>
    var upurl = '/admin/Blog/typeup';
    var ue = UE.getEditor('editor');
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;


        //监听提交
        form.on('submit(up)', function(data){
            $.post(upurl, data.field,function(res) {
                var success = JSON.parse(res);
                if(success.code===200){
                    layer.msg(success.msg, {
                        time: 1000, //不自动关闭
                        icon:6,
                        end:function () {
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        }
                    });
                    return false;
                }else {
                    layer.msg(success.msg)
                }
            });
        });
    });
</script>

</body>

</html>